import axios from 'axios'

const request = axios.create({
  baseURL: 'https://www.fastmock.site/mock/144700dfe8f08284cb5090a11e0945a3/PCR',
  timeout: 30000
})

export const post = (url, parameter = {}) => {
  return new Promise((resolve, reject) => {
    request.post(url, parameter).then((response) => {
      resolve(response.data)
    }, err => {
      reject(err)
    })
  })
}

export const get = (url, params = {}) => {
  return new Promise((resolve, reject) => {
    request.get(url, params).then((response) => {
      resolve(response.data)
    }, err => {
      reject(err)
    })
  })
}
